<template>
    <div>
        <div class="book-list">
            <div class="header">
                <div class="heading">最新更新</div>
                <div class="more">更多...</div>
            </div>
            <div class="book-items">
                <div class="book"
                     v-for="book in books">
                    <div class="cover" @click='$emit("hi",book)'>
                        <img :src="book.img_url"/>
                    </div>
                    <div class="title">{{ book.title }}</div>
                    <div class="authors">{{ book.authors|join}}</div>
                </div>
            </div>
        </div>
    <div class="book-list">
        <div class="header">
            <div class="heading">编辑推荐</div>
            <div class="more">更多...</div>
        </div>
        <div class="book-items">
            <div class="book"
                 v-for="book in recommended">
                <div class="cover">
                    <img :src="book.img_url"/>
                </div>
                <div class="title">{{ book.title }}</div>
                <div class="authors">{{ book.authors|join}}</div>
            </div>
        </div>
    </div>
    </div>

</template>

<script type="text/ecmascript-6">
    import './list.less'
    export default{
        props: ['books','recommended'],
        data(){
            return {
               /* recommended: [{img_url: require("./fixtures/covers/6.svg"), title: '自己动手做大数据', authors: '张粤磊'},
                    {img_url: require("./fixtures/covers/5.svg"), title: '智能硬件安全', authors: '刘健皓'},
                    {img_url: require("./fixtures/covers/4.svg"), title: '实战数据库营销-', authors: '张粤磊'},]
            */}
        },
        filters:{
            join(args){
                return args.join(',')
            }
        }
    }
</script>